package com.solarStruggle.actions

import java.awt.event.{InputEvent, KeyEvent}
import javax.swing.{ImageIcon, KeyStroke}
import scala.swing.{Action}
import controls.{GuiState, ZoomLevelChanged}
import util.{ResourceLoader}

/**
 * Action used to reset the zoom level of the main screen.
 */
class ZoomResetAction(state: GuiState) 
extends Action("Zoom Reset") {
  
  enabled = true
  toolTip = "Reset size of the main screen's elements"
  accelerator = Some(KeyStroke.getKeyStroke(KeyEvent.VK_0, InputEvent.CTRL_DOWN_MASK))
  icon = new ImageIcon(ResourceLoader.getResourceURL("img/actions/zoom-original.png"))
  smallIcon = new ImageIcon(ResourceLoader.getResourceURL("img/actions/zoom-original-small.png"))
  
  def apply() {
    state.zoomLevel = state.resetZoomLevel
  }
}
